package com.hsogoo.ultraman.event;

import java.util.Map;
import java.util.Set;

import com.hsogoo.ultraman.model.ConfigChange;

import lombok.ToString;

/**
 * Created by za-huangsaigang on 2018/9/13.
 */
@ToString
public class ConfigChangeEvent {

    private final String  namespace;
    private final Map<String, ConfigChange> changes;

    public ConfigChangeEvent(String namespace, Map changes){
        this.namespace = namespace;
        this.changes = changes;
    }

    public Set<String> changedKeys() {
        return changes.keySet();
    }

    public ConfigChange getChange(String key) {
        return changes.get(key);
    }

    public boolean isChanged(String key) {
        return changes.containsKey(key);
    }

    public String getNamespace(){
        return namespace;
    }

}
